home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-04 | 5.4 KB | 185 lines | [TEXT/MPS ] |
- #
- # File: ControlPanels.vulib
- #
- # Contains: Sample tasks for working with standard Macintosh Conrol Panels
- #
- # Requirements: System 7
- #
- # Written by: David G. Gaxiola
- #
- # Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
- #
- # Change History (most recent first):
- #
- # 3/1/96 JC Modified several of the descriptor ordinatilities in the CDEV tasks.
- # 6/16/92 DGG Created.
- #
- # To Do:
- #
-
- Libraries "QuickTasks.vulib", "UtilityTasks.vulib";
-
- (************************************************************************************
- * Task MonitorsCDEV(monType := "gray")
- * Will set the current monitor type, either "color" or "gray".
- ************************************************************************************)
- task MonitorsCDEV(monType := "gray")
- begin
- taskResult := false;
- if (LaunchAppInSystem7("Monitors", 6, true, true))
- begin
- taskResult := true;
- if (monType ~= /g≈/)
- begin
- select [radioButton t:"Grays:" w:[window o:1 t:"Monitors"]];
- end;
- else if (monType ~= /c≈/)
- begin
- select [radioButton t:"Colors:" w:[window o:1 t:"Monitors"]];
- end;
- else
- begin
- LogError("Unknown monitor type specified: must be ∂"gray∂" or ∂"color∂".");
- taskResult := false;
- end;
- end;
- else
- begin
- LogError("Could not launch Monitors CDEV!");
- taskResult := false;
- end;
- return taskResult;
- end;
-
- (************************************************************************************
- * Task KeyboardCDEV()
- * This task performs one action, to turn off the delay until repeat
- * characteristic.
- ************************************************************************************)
- task KeyboardCDEV()
- begin
- if (LaunchAppInSystem7("Keyboard", 6, true, true))
- begin
- taskResult := true;
- DoSelectRadioButton(35, "o");
- end;
- else
- begin
- taskResult := false;
- LogError("Could not launch Keyboard CDEV!");
- end;
- return taskResult;
- end;
-
- (************************************************************************************
- * Task HandlePossibleDialog(closeTime)
- * To be used by sharingSetupCDEV ... see below.
- * Will attempt to deal with any dialogs that may come up due to changing the state
- * of file sharing.
- ************************************************************************************)
- task HandlePossibleDialog(closeTime := 0)
- begin
- match [window o:1 s:?winStyle];
- if (winStyle = dialog)
- begin
- type k:{ tabKey, closeTime };
- select [button t:"OK" w:[window o:1]];
- end;
- end;
-
- (************************************************************************************
- * Task SharingSetupCDEV(setupTask, closeTime)
- * Possible parameters are the strings "sharing" and "linking" which will determine
- * whether the state of file sharing or program linking is toggled. The closeTime
- * variable will determine the length of time to wait until disconnecting people
- * using filesharing (if any).
- ************************************************************************************)
- task SharingSetupCDEV(setupTask := "sharing", closeTime := 0)
- begin
- if (LaunchAppInSystem7("Sharing Setup", 6, true, true))
- begin
- returnCode := true;
- if (setupTask ~= /s≈/)
- begin
- select [button o:2 w:[window o:1 t:"Sharing Setup"]];
- handlePossibleDialog(CloseTime);
- end;
- else if (setupTask ~= /l≈/)
- begin
- select [button o:1 w:[window o:1 t:"Sharing Setup"]];
- end;
- else
- begin
- LogError("Unknown action requested to be performed on Sharing Setup CDEV!");
- returnCode := false;
- end;
- end;
- else
- begin
- LogError("The Sharing Setup CDEV is not the top window!");
- returnCode := false;
- end;
- return returnCode;
- end;
-
- (************************************************************************************
- * Task ViewsCDEV(fontName, fontSize, iconView, listView, iconSize)
- * Will work with the views control panel. Custom view settings can be added.
- * Just add another else clause for the listView and the iconView which specifies
- * what you want done.
- ************************************************************************************)
- task ViewsCDEV(fontName := "Geneva", fontSize := "9", iconView := "default",
- listView := "default", iconSize := "small")
- begin
- if (LaunchAppInSystem7("Views", 6, true, true))
- begin
- returnCode := true;
-
- select [menuItem t:fontName m:[popup o:16 w:[window t:'Views' o:1]]];
- select [menuItem t:fontSize m:[popup o:15 w:[window t:'Views' o:1]]];
-
- if (listView = 'default')
- begin
- UnCheckBox('Calculate folder Sizes');
- UnCheckBox('Show disk info in header');
- DoCheckBox('Show size');
- DoCheckBox('Show kind');
- DoCheckBox('Show label');
- DoCheckBox('Show date');
- UnCheckBox('Show version');
- UnCheckBox('Show comments');
- end;
- else if (listView = 'shownothing')
- begin
- allCheckBoxes := collect [checkBox w:[window o:1]];
- for each singleCheckBox in allCheckBoxes
- UnCheckbox(singleCheckBox.t);
- end;
-
- if (iconView = 'default')
- begin
- match [contentItem t:'Straight grid' r:?contentLocation]!;
- SelectRectangle(contentLocation);
- UnCheckBox('Always snap to grid');
- end;
- else if (iconView = 'alwayssnap')
- begin
- DoCheckBox('Always snap to grid');
- end;
-
- if (iconSize = 'small')
- select [radioButton o:11 w:[window o:1]];
- else if (iconSize = 'medium')
- select [radioButton o:10 w:[window o:1]];
- else if (iconSize = 'large')
- select [radioButton t:'' o:9 w:[window o:1]];
- end;
- else
- begin
- returnCode := false;
- LogError("Could not launch Views CDEV!");
- end;
-
- return returnCode;
- end;
-